<script>
	import store from "@/store";
	import '@/utils/initializer.js'
	export default {
		onLaunch: function() {
			console.log('App Launch')
			// 获取系统信息并存储至本地
			const systemInfo = uni.getSystemInfoSync();
			// 胶囊按钮位置信息
			const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
			// 计算出胶囊距顶部距离 + 胶囊
			let gap = menuButtonInfo.height + (menuButtonInfo.top - systemInfo.statusBarHeight) * 2;
			// 状态栏高度
			let height = parseInt((gap + systemInfo.statusBarHeight))
			let lineHeight = menuButtonInfo.height
			let paddingTop = menuButtonInfo.top
			this.globalData.navBarHeight = String(height);
			this.globalData.lineHeight = String(lineHeight);
			this.globalData.paddingTop = String(paddingTop);
			uni.setStorageSync('navbarHeight', height)
			this.globalData.isAndroid = systemInfo.system.indexOf('Android') > -1
			this.globalData.isIOS = systemInfo.system.indexOf('iOS') > -1
		},
		onShow: function() {
			console.log('App Show')
			// 不是使用api导致的OnHide onShow触发才调用
			if (!this.globalData.isPriviewApi) {
				if (this.globalData.onHide) {
					this.globalData.onHide = false
					this.globalData.isPriviewApi = false
				}
			}
		},
		onHide: function() {
			console.log('App Hide')
			// 不是使用api导致的OnHide onShow触发才调用
			if (!this.globalData.isPriviewApi) {
				if (store.state.ble.devID) {
					wx.closeBLEConnection({
						deviceId: store.state.ble.devID,
						success: () => {
							console.log('断开成功')
						}
					})
				}
				this.globalData.onHide = true
			}
		},
		globalData: {
			isPriviewApi: false, // 是否是api要触发onHideOnshow事件
			onHide: false
		}
	}
</script>

<style lang="scss">
	@import "@/uni_modules/uview-ui/index.scss";
	@import '@/static/font/iconfont.css';
	@import '@/static/css/public.scss';



	/*每个页面公共css */
	view {
		box-sizing: border-box;
		text-align: center;
		font-family: PingFangSC-Regular, PingFang SC;
	}

	text {
		display: inline-block;
		box-sizing: border-box;
		font-family: PingFangSC-Regular, PingFang SC;
	}

	.next {
		width: 140rpx;
		height: 140rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: 92rpx;
		left: 50%;
		transform: translateX(-50%);
		background-color: #545dde;
		border-radius: 50%;
	}

	.save {
		width: 590rpx;
		height: 88rpx;
		position: fixed;
		bottom: 144rpx;
		left: 50%;
		transform: translateX(-50%);
	}


	.handleDate {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 60rpx;

		.handle {
			width: 240rpx;
			height: 76rpx;
		}

		.ml {
			margin-left: 44rpx;
		}
	}

	.custom-navbar {
		width: 100%;
		background-color: transparent;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		display: flex;
		align-items: flex-start;
		padding: 0 34rpx;
		color: #fff;

		.bakc_icon {
			width: 41%;
			display: flex;
			justify-content: flex-start;
			align-items: center;
		}

		.navbar-name {
			flex: 1;
			font-size: 34rpx;
			font-weight: 500;
			font-family: PingFangSC-Medium, PingFang SC;
			display: flex;
			flex-direction: row;
			align-items: flex-start;
			color: #000000;
		}
	}


	.date_box {
		width: 100%;
		padding: 40rpx 56rpx 68rpx;

		.picker-indicator {
			height: 100rpx;
			background-color: rgba(255, 255, 255, 0);
			z-index: 0;
		}

		.picker-view {
			width: 100%;
			height: 550rpx;
			text-align: center;

			.picker-column {

				.year,
				.month,
				.date {
					height: 100% !important;
					line-height: 100rpx !important;
					font-size: 32rpx;
					font-weight: 500;
				}
			}
		}
	}


	.horizontal-box {
		padding-top: 40rpx !important;

		.scale-wrapper {
			border: 0;
		}

		.scale-vaule {
			padding: 0 !important;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			line-height: 40rpx;
			color: #666666;
			margin-top: 8rpx;
		}

		.scale-grip-item {
			height: 48rpx !important;
			border-width: 2px;
			border-color: rgba(#1F2434, .5) !important;
		}

		.zz {
			width: 28rpx !important;
			height: 88rpx !important;
			background-color: transparent !important;
		}
	}

	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;

		.pop_main {
			width: 658rpx;
			height: 908rpx;
			background-image: url('http://oss.antaimedical.com/images/static/2024/08/66b2d15de4b09217821c0fa7AEIBePXbi1e519cece223543faac78e3cb17b28d4590.png');
			background-repeat: no-repeat;
			background-size: 100% 100%;
			padding: 456rpx 56rpx 74rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.content {
				padding: 0 48rpx;
				font-size: 32rpx;
				color: #353535;
				letter-spacing: 1px;
			}

			.handle {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 196rpx;

				.cancel,
				.confirm {
					width: 240rpx;
					height: 76rpx;
					background-color: #1F2434;
					color: #ffffff;
					font-size: 36rpx;
					border-radius: 38rpx;
					text-align: center;
					line-height: 76rpx;
				}

				.cancel {
					color: #1F2434;
					background-color: #ffffff;
					border: 4rpx solid #1F2434;
					line-height: 68rpx;
				}
			}
		}

	}

	.large_button {
		width: 80%;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		background: #545DDE;
		border-radius: 16rpx;
		color: #fff;
		font-size: 36rpx;
	}

	// ui框架样式
	.u-modal {
		border-radius: 16rpx !important;

		.u-modal__title {
			padding-top: 68rpx !important;
			font-size: 34rpx !important;
			font-family: PingFangSC, PingFang SC;
			font-weight: 500 !important;
			color: #353535 !important;
		}

		.u-modal__content {
			padding-bottom: 28rpx !important;
		}

		.u-modal__button-group__wrapper {
			height: 110rpx !important;
		}

		.u-modal__button-group__wrapper__text {
			font-size: 34rpx !important;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			letter-spacing: 1px;
		}
	}

	.u-cell-group {
		border-radius: 16rpx;
		background-color: #fff;

		.u-cell__body {
			padding: 36rpx 48rpx !important;

			.u-cell__title-text {
				font-family: PingFangSC-Regular, PingFang SC;
				font-size: 32rpx !important;
				color: #666666 !important;
			}
		}
	}

	//  日历控件样式
	.u-calendar {
		padding: 48rpx 32rpx;

		.u-calendar-header {
			color: #333333;

			.u-calendar-header__title {
				height: 44rpx !important;
				font-size: 32rpx !important;
				font-weight: 500 !important;
				line-height: 44rpx !important;
			}

			.u-calendar-header__subtitle {
				height: 40rpx !important;
				font-size: 28rpx !important;
				font-weight: 400 !important;
				line-height: 40rpx !important;
				margin: 64rpx 0 48rpx;
			}



		}

		.u-calendar-month-wrapper {
			.u-calendar-month__title {
				margin-top: 96rpx;
				font-size: 28rpx !important;
				font-weight: 400 !important;
				color: #333333 !important;
				height: 40rpx !important;
				line-height: 40rpx !important;
			}

			.u-calendar-month__days__day__select__info {
				font-size: 28rpx !important;
			}
		}

		.u-button {
			height: 88rpx !important;
			border-radius: 16rpx !important;
		}
	}


	.btn {
		width: 300rpx;
		height: 100rpx;
		background-color: #169bd5;
		color: #fff;
		text-align: center;
		line-height: 100rpx;
		font-size: 28rpx;
		font-weight: 400;
		border-radius: 20rpx;
		margin-top: 50rpx;
	}
</style>